import 'package:wanxiang_app/generated/json/base/json_convert_content.dart';
import 'package:wanxiang_app/bean/news_detail_entity.dart';

NewsDetailEntity $NewsDetailEntityFromJson(Map<String, dynamic> json) {
  final NewsDetailEntity newsDetailEntity = NewsDetailEntity();
  final int? code = jsonConvert.convert<int>(json['code']);
  if (code != null) {
    newsDetailEntity.code = code;
  }
  final String? msg = jsonConvert.convert<String>(json['msg']);
  if (msg != null) {
    newsDetailEntity.msg = msg;
  }
  final NewsDetailData? data = jsonConvert.convert<NewsDetailData>(
      json['data']);
  if (data != null) {
    newsDetailEntity.data = data;
  }
  return newsDetailEntity;
}

Map<String, dynamic> $NewsDetailEntityToJson(NewsDetailEntity entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['code'] = entity.code;
  data['msg'] = entity.msg;
  data['data'] = entity.data.toJson();
  return data;
}

extension NewsDetailEntityExtension on NewsDetailEntity {
  NewsDetailEntity copyWith({
    int? code,
    String? msg,
    NewsDetailData? data,
  }) {
    return NewsDetailEntity()
      ..code = code ?? this.code
      ..msg = msg ?? this.msg
      ..data = data ?? this.data;
  }
}

NewsDetailData $NewsDetailDataFromJson(Map<String, dynamic> json) {
  final NewsDetailData newsDetailData = NewsDetailData();
  final int? id = jsonConvert.convert<int>(json['id']);
  if (id != null) {
    newsDetailData.id = id;
  }
  final String? title = jsonConvert.convert<String>(json['title']);
  if (title != null) {
    newsDetailData.title = title;
  }
  final String? content = jsonConvert.convert<String>(json['content']);
  if (content != null) {
    newsDetailData.content = content;
  }
  final int? type = jsonConvert.convert<int>(json['type']);
  if (type != null) {
    newsDetailData.type = type;
  }
  final String? addTime = jsonConvert.convert<String>(json['add_time']);
  if (addTime != null) {
    newsDetailData.addTime = addTime;
  }
  final String? updateTime = jsonConvert.convert<String>(json['update_time']);
  if (updateTime != null) {
    newsDetailData.updateTime = updateTime;
  }
  final int? sortId = jsonConvert.convert<int>(json['sort_id']);
  if (sortId != null) {
    newsDetailData.sortId = sortId;
  }
  final int? lookNum = jsonConvert.convert<int>(json['look_num']);
  if (lookNum != null) {
    newsDetailData.lookNum = lookNum;
  }
  final String? userName = jsonConvert.convert<String>(json['user_name']);
  if (userName != null) {
    newsDetailData.userName = userName;
  }
  final String? platform = jsonConvert.convert<String>(json['platform']);
  if (platform != null) {
    newsDetailData.platform = platform;
  }
  final String? imgUrl = jsonConvert.convert<String>(json['img_url']);
  if (imgUrl != null) {
    newsDetailData.imgUrl = imgUrl;
  }
  final String? introduce = jsonConvert.convert<String>(json['introduce']);
  if (introduce != null) {
    newsDetailData.introduce = introduce;
  }
  final int? previousId = jsonConvert.convert<int>(json['previous_id']);
  if (previousId != null) {
    newsDetailData.previousId = previousId;
  }
  final String? previousTitle = jsonConvert.convert<String>(
      json['previous_title']);
  if (previousTitle != null) {
    newsDetailData.previousTitle = previousTitle;
  }
  final int? nextId = jsonConvert.convert<int>(json['next_id']);
  if (nextId != null) {
    newsDetailData.nextId = nextId;
  }
  final String? nextTitle = jsonConvert.convert<String>(json['next_title']);
  if (nextTitle != null) {
    newsDetailData.nextTitle = nextTitle;
  }
  return newsDetailData;
}

Map<String, dynamic> $NewsDetailDataToJson(NewsDetailData entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['id'] = entity.id;
  data['title'] = entity.title;
  data['content'] = entity.content;
  data['type'] = entity.type;
  data['add_time'] = entity.addTime;
  data['update_time'] = entity.updateTime;
  data['sort_id'] = entity.sortId;
  data['look_num'] = entity.lookNum;
  data['user_name'] = entity.userName;
  data['platform'] = entity.platform;
  data['img_url'] = entity.imgUrl;
  data['introduce'] = entity.introduce;
  data['previous_id'] = entity.previousId;
  data['previous_title'] = entity.previousTitle;
  data['next_id'] = entity.nextId;
  data['next_title'] = entity.nextTitle;
  return data;
}

extension NewsDetailDataExtension on NewsDetailData {
  NewsDetailData copyWith({
    int? id,
    String? title,
    String? content,
    int? type,
    String? addTime,
    String? updateTime,
    int? sortId,
    int? lookNum,
    String? userName,
    String? platform,
    String? imgUrl,
    String? introduce,
    int? previousId,
    String? previousTitle,
    int? nextId,
    String? nextTitle,
  }) {
    return NewsDetailData()
      ..id = id ?? this.id
      ..title = title ?? this.title
      ..content = content ?? this.content
      ..type = type ?? this.type
      ..addTime = addTime ?? this.addTime
      ..updateTime = updateTime ?? this.updateTime
      ..sortId = sortId ?? this.sortId
      ..lookNum = lookNum ?? this.lookNum
      ..userName = userName ?? this.userName
      ..platform = platform ?? this.platform
      ..imgUrl = imgUrl ?? this.imgUrl
      ..introduce = introduce ?? this.introduce
      ..previousId = previousId ?? this.previousId
      ..previousTitle = previousTitle ?? this.previousTitle
      ..nextId = nextId ?? this.nextId
      ..nextTitle = nextTitle ?? this.nextTitle;
  }
}